<?php session_start();

/*
 *  Registration form for Coliberator
 *  Copyright (C) 2014 Fundația Ceata - http://ceata.org
 *  
 *  Author: Victor Nițu (vnitu@ceata.org)
 *  
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *  
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *  
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

$filename = dirname(__FILE__) . '/coliberator2014.db';
$db  = new SQLite3($filename);

function count_all() {
    global $db;
    $counter = $db->querySingle("SELECT count(*) AS c FROM PARTICIPANTS;");
    echo $counter;
}
?>
<!doctype html>
<html class="no-js" lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Coliberator 2014 :: Înscriere | Registration</title>
    <link rel="stylesheet" href="./css/foundation.css" />
    <link rel="stylesheet" href="./css/coliberator.css" />
    <script src="./js/3dparty/modernizr.js"></script>
  </head>
  <body>
    
    <div class="row">
      <div class="large-12 columns">
        <h1><a href="http://coliberator.ro">Coliberator 2014</a></h1>
      </div>
    </div>
    
    <div class="row">
        <div class="row">
          <div class="small-7 medium-8 large-8 columns">
                <h3>Formular de înregistrare | Registration form</h3>
                <p>Vă rugăm să utilizați acest formular pentru înscrierea la conferința Coliberator.
                <br>
                Please use this registration form in order to attend the Coliberator conference.</p>
              </div>
              <div class="small-5 medium-4 large-4 columns panel">
                  <h1 id="counter"><?php count_all(); ?></h1>
                  <span class="counter-text">people registered so far / </span>
                  <span class="counter-text">persoane inregistrate până acum</span>
              </div>
        </div>

        <hr>

        <ul class="large-block-grid-2">
            <li>
                <form action="./register.php" method="post" data-abide>
                    <div class="row">
                    <div class="large-11 columns">
                        <label for="fullname"> Numele complet sau pseudonimul (full name or nickname)
                            <input id="fullname" type="text" name="fullname" placeholder="Numele complet / full name">
                            <input id="anoncheck" type="checkbox"><label for="anoncheck">Anonim / Anonymous</label>
                        </label>
                    </div>
                </div>
                <div class="row">
                    <div class="large-11 columns">
                        <label for="email"> Email*
                            <input type="email" required name="email" placeholder="Email">
                            <small class="error">Introduceți o adresă validă / Please input a valid address</small>
                        </label>
                    </div>
                </div>
                <div class="row">
                    <div class="large-11 columns">
                        <label for="skill"> Meșteșug / skill (jurnalist/activist/programator/designer etc.)
                            <input type="text" name="skill" placeholder="Optional">
                        </label>
                    </div>
                </div>
                <hr>
                <div class="row">
                    <div class="large-12 columns">
                    <div class="row">
                        <div class="large-4 columns">
                            <img id="captcha" src="./securimage/securimage_show.php" alt="CAPTCHA Image" />
                        </div>
                        <div class="large-4 columns">
                            <span class="radius secondary label" href="#" onclick="document.getElementById('captcha').src = './securimage/securimage_show.php?' + Math.random(); return false">[ Different Image ]</span>
                            <input type="text" name="captcha_code" maxlength="6" />
                        </div>
                        <div class="large-3 columns">
                            <input type="submit" class="button small radius right" value="Trimite / Submit">
                        </div>
                    </div>
                    </div>
                </div>
            </form>
        </li>
        <li>
            <p>Adresele de email vor fi folosite doar în scopul validării 
            participanților și informării lor ulterioare asupra potențialelor modificări 
            ale programului. Adresele colectate astfel NU vor fi folosite în scopul 
            transmiterii de materiale promoționale sau alte mesaje nesolicitate.
            Adresele participanților NU vor fi afișate pe sit și nu vor fi făcute publice.</p>
            <p>The email addresses will be used for the sole purpose of validation
            of participants and to further inform them about eventual changes 
            in the event's schedule. The addresses collected this way will NOT be used for 
            sending promotional materials and other unsolicited materials.
            Participants' addresses will NOT be displayed on the website and will not be made public.</p>
        </li>
    </ul>

    
    <script src="js/3rdparty/jquery.js"></script>
    <script src="js/foundation.min.js"></script>
    <script>
    // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later

      $(document).foundation();
      $('#anoncheck').click(function () {
          var fn = $('#fullname');
          if ($('#anoncheck').is(':checked')) {
            fn.attr('disabled', 'disabled');
            fn.attr('style', 'background-color: #666 !important;');
          } else {
            fn.removeAttr('disabled');
            fn.removeAttr('style');
          }
      });
    // @license-end
    </script>
  </div>
  <div class="row">
        <span class="copyright">
            &copy; 2013,2014 <a href="http://ceata.org/">Fundația Ceata</a>. Aplicația este pusă <a href="http://gitlab.com/ceata/coliberator-ro" target="__blank">la dispoziție</a> sub licența liberă <a href="http://www.gnu.org/licenses/agpl-3.0.html" target="__blank">GNU AGPLv3+</a>. Textul și imaginile sunt publicate sub licența liberă <a href="https://creativecommons.org/licenses/by-sa/3.0/" target="_blank">CC BY-SA 3.0</a>.
        </span>
  </div>
  </body>
</html>
